










# from tkinter import *
# # 主窗口
# win = Tk()
# win.config(bg='#87CEEB')
# win.title("yolo")
# win.geometry('800x450+300+300')
# win.iconbitmap('C:/Users/DELL/Pictures/PPT图片/favicon.ico')

# # 在窗口内创建按钮，以表格的形式依次排列
# for i in range(36):
#     for j in range(36):
#         Button(win, text="(" + str(i) + "," + str(j) + ")", bg='#D1EEEE',width=3,height=1).grid(row=i, column=j)
# # 在第5行第11列添加一个Label标签
# Label(win, text="yolo", fg='blue', font=('楷体', 12, 'bold'),width=3,height=1).grid(row=18, column=18)
# # 开始窗口的事件循环
# win.mainloop()







# #grid标签布局
# import tkinter as tk
# win =tk.Tk() 
# win.title("YOLO")
# win.geometry('450x350+200+200')
# win.iconbitmap('C:/Users/DELL/Pictures/PPT图片/favicon.ico')

# fram1 = tk.Frame(win)
# fram1.pack()

# fram_left = tk.Frame(fram1)
# tk.Label(fram_left,text='左侧标签1',bg='green',width=10,height=5).grid(row=0,column=0)
# tk.Label(fram_left,text='左侧标签2',bg='blue',width=10,height=5).grid(row=1,column=1)
# fram_left.pack(side=tk.LEFT)

# fram_right = tk.Frame(fram1)
# tk.Label(fram_right,text='右侧标签1',bg='gray',width=10,height=5).grid(row=0,column=1)
# tk.Label(fram_right,text='右侧标签2',bg='pink',width=10,height=5).grid(row=1,column=0)
# tk.Label(fram_right,text='右侧标签3',bg='purple',width=10,height=5).grid(row=1,column=1)
# fram_right.pack(side=tk.RIGHT)

# win.mainloop()








# from tkinter import*
# import tkinter.messagebox

# # 创建主窗口
# win =Tk() 
# win.config(bg='#87CEEB')
# win.title("YOLO")
# win.geometry('450x350+300+200')
# win.iconbitmap('C:/Users/DELL/Pictures/PPT图片/favicon.ico')

# # 创建一个执行函数，点击下拉菜单中命令时执行
# def menuCommand():
#     tkinter.messagebox.showinfo("下拉菜单", "您正在使用下拉菜单功能")

# # 创建主目录菜单（顶级菜单）
# mainmenu = Menu(win)

# # 在顶级菜单上新增“文件”菜单的子菜单，同时不添加分割线
# filemenu = Menu(mainmenu, tearoff=False)

# # 新增“文件”菜单的菜单项，并使用 accelerator 设置菜单项的快捷键（实现对应具体方法）
# filemenu.add_command(label="新建", command=menuCommand, accelerator="Ctrl+N")
# filemenu.add_command(label="打开", command=menuCommand, accelerator="Ctrl+O")
# filemenu.add_command(label="保存", command=menuCommand, accelerator="Ctrl+S")
# # 添加一条分割线
# filemenu.add_separator()
# filemenu.add_command(label="退出", command=win.quit)
# # 在主目录菜单上新增“文件”选项，并通过 menu 参数与下拉菜单绑定
# mainmenu.add_cascade(label="文件", menu=filemenu)

# # 将主菜单设置在窗口上
# win.config(menu=mainmenu)

# # 绑定键盘事件，按下键盘上的相应的键时都会触发执行函数
# win.bind("<Control-n>", lambda event: menuCommand())
# win.bind("<Control-N>", lambda event: menuCommand())
# win.bind("<Control-o>", lambda event: menuCommand())
# win.bind("<Control-O>", lambda event: menuCommand())
# win.bind("<Control-s>", lambda event: menuCommand())
# win.bind("<Control-S>", lambda event: menuCommand())

# # 显示主窗口
# win.mainloop()














# #将菜单绑定鼠标
# import tkinter as tk
# root = tk.Tk()
# root.config(bg='#8DB6CD')
# root.title("清风小竹楼")
# root.geometry('400x300')
# root.iconbitmap('C:/Users/DELL/Pictures/PPT图片/favicon.ico')

# def func():
#     print('您通过弹出菜单执行了命令')
# # 创建一个弹出菜单
# menu = tk.Menu(root, tearoff=False)
# menu.add_command(label="新建", command=func)
# menu.add_command(label="复制", command=func)
# menu.add_command(label="粘贴", command=func)
# menu.add_command(label="剪切", command=func)

# # 定义事件函数
# def command(event):
#     # 使用 post()在指定的位置显示弹出菜单
#     menu.post(event.x_root, event.y_root)

# # 绑定鼠标右键，这是鼠标绑定事件
# # <Button-3>表示点击鼠标的右键，1 表示左键，2表示点击中间的滑轮
# root.bind("<Button-3>", command)
# root.mainloop()







# #菜单
# from tkinter import*
# import tkinter . messagebox
# win = Tk()
# win.title("清风小竹楼")
# win.iconbitmap('C:/Users/DELL/Pictures/PPT图片/favicon.ico')
# win.geometry('400x300')
# win.config(bg='#87CEEB')

# def menuCommand():
#     tkinter.messagebox.showinfo("主菜单栏","你正在使用主菜单栏")
# main_menu = Menu (win)
# main_menu.add_command(label="文件",command=menuCommand)
# main_menu.add_command(label="编辑",command=menuCommand)
# main_menu.add_command(label="格式",command=menuCommand)
# main_menu.add_command(label="查看",command=menuCommand)
# main_menu.add_command(label="帮助",command=menuCommand)
# #显示菜单
# win.config(menu=main_menu)
# win.mainloop()






# #撤销与回复按钮
# from tkinter import*
# win = Tk()
# win.title("清风小竹楼")
# win.iconbitmap('C:/Users/DELL/Pictures/PPT图片/favicon.ico')
# win.geometry('400x300')
# text = Text(win,width=50,height=20,undo=True,autoseparators=False)
# text.grid()
# text.insert(INSERT,'清风小竹楼')
# def backout():
#     text.edit_undo()
# def regain():
#     text.edit_redo()
# Button(win,text='撤销',command=backout).grid(row=3,column=0,sticky="w",padx=10,pady=5)
# Button(win,text='恢复',command=regain).grid(row=3,column=0,sticky="e",padx=10,pady=5)
# win.mainloop()




# #Text文本控件
# from tkinter import*
# win = Tk()
# win.title("清风小竹楼")
# win.iconbitmap('C:/Users/DELL/Pictures/PPT图片/favicon.ico')
# win.geometry('400x200')
# text = Text(win,width=50,height=30,undo=True,autoseparators=False)
# text,Pack()
# text.insert(INSERT,'清风小竹楼')
# win.mainloop()






# Spinbox输入框控件
# import tkinter as tk
# root = tk.Tk()
# root.title("清风小竹楼")
# root.geometry('300x200+300+300')
# root.iconbitmap('C:/Users/DELL/Pictures/PPT图片/favicon.ico')
# w = tk.Spinbox(root,from_=0,to=20,increment=2,width=15,bg='#9BCD9B')
# w.pack()
# strings = tk.Spinbox(root,values=('Python','java','c语言','PHP'))
# strings.pack()
# root.mainloop()






# 面向对象
# from tkinter import messagebox
# import re
# win = tk.Tk()
# # 设置主窗口
# win.geometry('250x200+250+200')
# win.title("清风小竹楼")
# win.iconbitmap('C:/Users/DELL/Pictures/PPT图片/favicon.ico')
# win.resizable(0,0)

# # 账号验证函数
# def check_account(account):
#     if not account:
#         messagebox.showwarning("输入不正确", "账号不能为空！")
#         return False
#     if not account.isdigit():
#         messagebox.showwarning("输入不正确", "账号必须为数字！")
#         return False
#     return True
 
# # 密码验证函数
# def check_password(password):
#     if not password:
#         messagebox.showwarning("输入不正确", "密码不能为空！")
#         return False
#     # 验证密码长度
#     if len(password) < 8:
#         messagebox.showwarning("输入不正确", "密码长度必须大于8!")
#         return False
#     # 验证是否包含大写字母
#     if not re.search(r'[A-Z]', password):
#         messagebox.showwarning("输入不正确", "密码必须包含大写字母！")
#         return False
#     # 验证是否包含小写字母
#     if not re.search(r'[a-z]', password):
#         messagebox.showwarning("输入不正确", "密码必须包含小写字母！")
#         return False
#     # 验证是否包含特殊字符（非字母数字）
#     if not re.search(r'[^a-zA-Z0-9]', password):
#         messagebox.showwarning("输入不正确", "密码必须包含特殊字符！")
#         return False
#     return True

# # 总验证函数，调用账号和密码验证
# def check():
#     account = entry1.get()
#     # 先验证账号，账号验证失败则直接返回
#     if not check_account(account):
#         entry1.delete(0, tk.END)
#         return False
    
#     password = entry2.get()
#     # 再验证密码
#     if check_password(password):
#         messagebox.showinfo("输入正确", "账号和密码格式均正确")
#         return True
#     return False
    
# # 新建文本标签
# labe1 = tk.Label(win,text="账号：")
# labe2 = tk.Label(win,text="密码：")
# labe1.grid(row=0)
# labe2.grid(row=1)
# # 创建动字符串
# Dy_String = tk.StringVar()
# # 使用验证参数 validata,参数值为 focusout 当失去焦点的时候，验证输入框内容是否正确
# entry1 = tk.Entry(win,textvariable =Dy_String,validate ="focusout",validatecommand=check)
# entry2 = tk.Entry(win)

# # 对控件进行布局管理，放在文本标签的后面
# entry1.grid(row=0, column=1)
# entry2.grid(row=1, column=1)

# # 添加确认按钮
# submit_btn = tk.Button(win, text="确认", command=check).grid(row=5, column=1, columnspan=2,padx=20,pady=15)
# win.mainloop()







# from tkinter import messagebox
# win = tk.Tk()
# win.title("清风小竹楼")
# win.iconbitmap('C:/Users/DELL/Pictures/PPT图片/favicon.ico')
# win.geometry('400x200+100+100')
# win.resizable(0,0)

# tk.Label(win, text="账号：").grid(row=0)
# tk.Label(win, text="密码：").grid(row=1)

# e1 = tk.Entry(win)
# e2 = tk.Entry(win,show='*')
# e1.grid(row=0,column=1,padx=10,pady=5)
# e2.grid(row=1,column=1,padx=10,pady=5)
# def login():
#     messagebox.showinfo('欢迎到来')

# tk.Button(win,text='登录',width=10,command=login).grid(row=3,column=0,sticky="w",padx=10,pady=5)
# tk.Button(win,text='退出',width=10,command=win.quit).grid(row=3,column=1,sticky="e",padx=10,pady=5)
# win.mainloop()









# from tkinter import messagebox
# window= tk.Tk()
# window.title('C语言中文网')
# window.geometry('400x300+300+200')
# def click_button():
#     messagebox.showinfo(title='温馨提示',message='欢迎使用c语言中文网')
# button = tk.Button(window,text='点击前往',bg='#7CCD7C',width=20,height=5,command=click_button).pack()
# window.mainloop()







# win = tk.Tk()
# win.title("清风小竹楼")
# win.geometry('400x200')
# win.iconbitmap('C:/Users/DELL/Pictures/PPT图片/favicon.ico')
# label = tk.Label(win, text="网址：c.biancheng.net",font=('宋体',20,'bold italic'),bg="#7CCD7C",
#         width=30,height=5,padx=10,pady=15,borderwidth=10,relief="sunken")
# label.pack()
# win.mainloop()







# import time
# root= tk.Tk()
# root.title("YOLO")
# root.iconbitmap('C:/Users/DELL/Pictures/PPT图片/favicon.ico')
# root.geometry('450x150+100+100')
# root.resizable(0,0)
# root.title('我们的时钟')

# def gettime():
#     dstr.set(time.strftime("%H:%M:%S"))
#     root.after(1000,gettime)

# dstr = tk.StringVar()
# lb = tk.Label(root,textvariable=dstr,fg='green',font=("微软雅黑",85))
# lb.pack()

# gettime()
# root.mainloop()








# Window =tk.Tk()
# Window.title('YOLO')
# Window.geometry('300x300')
# Window.iconbitmap('C:/Users/DELL/Pictures/PPT图片/favicon.ico')

# def callback():
#     print("执行回调函数","YOLO欢迎你")

# button = tk.Button(Window, text="执行", command=callback)
# button.pack()
# Window.mainloop()






# window=tk.Tk()

# window.title('TCP')

# window.geometry('800x400')

# print("电脑的分辨率是%dx%d"%(window.winfo_screenwidth(),window.winfo_screenheight()))

# window.update()

# print("窗口的分辨率是%dx%d"%(window.winfo_width(),window.winfo_height()))

# window.config(background="#2F41C7")

# window.attributes('-topmost',True)

# window.attributes('-alpha',1)
# window.maxsize(900,900)
# window.minsize(50,50)

# window.iconbitmap('C:/Users/DELL/Pictures/2023.ico')

# text=tk.Label(window,text="人山人海雅座一位",bg="yellow",fg="red",font=('Times',15,'bold italic underline'))

# text.pack()

# button=tk.Button(window,text="关闭",command=window.quit)

# button.pack(side="bottom")

# window.mainloop()







# # -*- coding:utf-8 -*-
# import tkinter as tk
# # 调用Tk()创建主窗口
# root_window =tk.Tk()
# # 给主窗口起一个名字，也就是窗口的名字
# root_window.title('智能识别系统')
# # 设置窗口大小
# root_window.geometry('600x400')
# # 设置主窗口的背景颜色,颜色值可以是英文单词，或者颜色值的16进制数,除此之外还可以使用Tk内置的颜色常量
# root_window["background"] = "#C9C9C9"
# # 添加文本内,设置字体的前景色和背景色，和字体类型、大小
# text=tk.Label(root_window,text="智能识别网站，欢迎您",bg="yellow",fg="red",font=('黑体', 25, 'bold italic'))
# # 将文本内容放置在主窗口内
# text.pack()
# # 添加按钮，以及按钮的文本，并通过command 参数设置关闭窗口的功能
# button=tk.Button(root_window,text="关闭",command=root_window.quit)
# # 将按钮放置在主窗口内
# button.pack(side="bottom")
# #开启主循环，让窗口处于显示状态
# root_window.mainloop()